package com.efun.framework.beetlsql;

import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
import org.springframework.context.annotation.Import;

import java.lang.annotation.*;

/**
 * @author kinven on 17-8-14.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import(MapperScannerRegistrar.class)
public @interface EnableBeetlSqlScanner {

    /**
     * Alias for the {@link #basePackages()} attribute. Allows for more concise
     * annotation declarations e.g.:
     * {@code @EnableBeetlSqlScanner("org.my.pkg")} instead of {@code
     * @EnableBeetlSqlScanner(basePackages= "org.my.pkg"})}.
     */
    String[] value() default {};

    /**
     * Base packages to scan for MyBatis interfaces. Note that only interfaces
     * with at least one method will be registered; concrete classes will be
     * ignored.
     */
    String[] basePackages() default {};


    /**
     * The {@link BeanNameGenerator} class to be used for naming detected components
     * within the Spring container.
     */
    Class<? extends BeanNameGenerator> nameGenerator() default AnnotationBeanNameGenerator.class;

    /**
     * Specifies which suffix {@code SqlSessionTemplate} to use.
     */
    String suffix() default BeetlSqlProperties.DAO_SUFFIX;


    /**
     * Specifies a custom MapperFactoryBean to return a mybatis proxy as spring bean.
     *
     */
    String sqlManagerFactoryBeanName() default BeetlSqlProperties.SQL_MANAGER_FACTORY_BEAN_NAME;

}
